class SavePicture
	  def self.user_path(user_id)
	    unless user_id.blank?
	        "#{Rails.root}/public/store/#{user_id}"
	    end
	  end

	def self.make_user_dir(user_id,path)
    		FileUtils.mkdir_p "#{user_path(user_id)}/#{path}"
  	end

  	def self.user_images(user_id)
	    unless user_id.blank?
	      make_user_dir(user_id,"images") unless exist_path?(user_id,"images")
	      "/public/users_contents/#{user_id}/images"
	    end
	 end

	 def self.saveFile(file,path)
	    File.open(path, 'wb') do |of|
	         of.write(file.read)
	    end
	 end

	 def self.show_path(user_id,path)
	 	"/store/#{user_id}/#{path}/images.png"
	 end
end
